//
//  LocationViewController.m
//  ios-test
//
//  Created by Apple -11 on 15/10/19.
//  Copyright (c) 2015年 Apple -11. All rights reserved.
//

#import "LocationViewController.h"

@interface LocationViewController ()

@end

@implementation LocationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    mapView=[[BMKMapView alloc]initWithFrame:CGRectMake(0,60, self.view.frame.size.width, self.view.frame.size.height-60)];
    [self.myView addSubview:mapView];
    
    

    
    BMKPointAnnotation *pointAnnotation1 = [[BMKPointAnnotation alloc]init];
    CLLocationCoordinate2D coor1;
    coor1.latitude = 39.14790;
    coor1.longitude = 117.4061960;
    pointAnnotation1.coordinate = coor1;
    pointAnnotation1.title = @"麦当劳";
    pointAnnotation1.subtitle = @"天津市东丽区中心大道";
    [mapView addAnnotation:pointAnnotation1];
    
    
    BMKPointAnnotation *pointAnnotation2 = [[BMKPointAnnotation alloc]init];
    CLLocationCoordinate2D coor2;
    coor2.latitude = 39.1383450000;
    coor2.longitude = 117.4045790000;
    pointAnnotation2.coordinate = coor2;
    pointAnnotation2.title = @"致馨公寓";
    pointAnnotation2.subtitle = @"天津市东丽区西八道";
    [mapView addAnnotation:pointAnnotation2];
    
    BMKPointAnnotation *pointAnnotation3 = [[BMKPointAnnotation alloc]init];
    CLLocationCoordinate2D coor3;
    coor3.latitude = 39.1396890000;
    coor3.longitude = 117.4030880000;
    pointAnnotation3.coordinate = coor3;
    pointAnnotation3.title = @"天保工业园";
    pointAnnotation3.subtitle = @"天津市东丽区中环西路";
    [mapView addAnnotation:pointAnnotation3];
    
    BMKPointAnnotation *pointAnnotation4 = [[BMKPointAnnotation alloc]init];
    CLLocationCoordinate2D coor4;
    coor4.latitude = 39.1468380000;
    coor4.longitude = 117.4123940000;
    pointAnnotation4.coordinate = coor4;
    pointAnnotation4.title = @"复地温莎堡";
    pointAnnotation4.subtitle = @"天津市东丽区西七道";
    [mapView addAnnotation:pointAnnotation4];
    
    
    [mapView setCenterCoordinate:coor3 animated:YES];
    
    [mapView setMinZoomLevel:16.0f];

    
    // Do any additional setup after loading the view, typically from a nib.
}
-(void)viewWillAppear:(BOOL)animated{
    [mapView viewWillAppear];
    mapView.delegate=self;
}
-(void)viewWillDisappear:(BOOL)animated{
    [mapView viewWillDisappear];
    mapView.delegate=nil;
}

-(void)mapView:(BMKMapView *)mapView onClickedBMKOverlayView:(BMKOverlayView *)overlayView{
    NSLog(@"点击");
}
-(void)mapview:(BMKMapView *)mapView onLongClick:(CLLocationCoordinate2D)coordinate{
    NSLog(@"点击2");
}
-(void)mapView:(BMKMapView *)mapView didSelectAnnotationView:(BMKAnnotationView *)view{
    NSLog(@"点击4");
}
-(void)mapView:(BMKMapView *)mapView onClickedMapBlank:(CLLocationCoordinate2D)coordinate{
    NSLog(@"点击5");
}
-(void)mapView:(BMKMapView *)mapView onClickedMapPoi:(BMKMapPoi *)mapPoi{
    NSLog(@"点击6");
}



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
-(IBAction)toBack:(id)sender{
    [self dismissViewControllerAnimated:YES completion:nil];}
@end
